<template>
	<div class="modal" :class='openmodal'>
	  <div class="modal-background"></div>
	  <div class="modal-card">
	    <header class="modal-card-head">
	      <p class="modal-card-title">更新 {{ list.name }} 的资料</p>
	      <button class="delete" aria-label="close" @click='close'></button>
	    </header>
	    <section class="modal-card-body">
	      <div class="field">
	        <label class="label">姓名</label>
	        <div class="control">
	          <input class="input" :class=" " readonly type="text" placeholder="Name" v-model="list.name">
	        </div> 
	      </div>

	      <div class="field">
	        <label class="label">手机</label>
	        <div class="control">
	          <input class="input" :class=" " readonly type="number" placeholder="Phone" v-model="list.phone">
	        </div> 
	      </div>

	      <div class="field">
	        <label class="label">货款额度</label>
	        <div class="control">
	          <input class="input" :class=" " type="text"   v-model="list.prices">
	        </div>
	         
	      </div>

	    </section>
	    <footer class="modal-card-foot">
	      <button class="button is-success" @click='update'>Update</button>
	      <button class="button" @click='close'>Cancel</button>
	    </footer>
	  </div>
	</div>
</template>

<script>
	export default{
		props:['openmodal'],
		data(){
			return{
				list:{},
			}
		},
		methods:{
			close(){
				this.$emit('closeRequest')
			},
			update(){
			axios.patch(`/update-prices/${this.list.name}`,this.$data.list).then((response)=> this.close())
				  .catch((error) => this.errors = error.response.data.errors)
			}
		}
	}
</script>